﻿#include "DADataManageTableView.h"
#include "DADataManagerTableModel.h"
#include <QHeaderView>
#include "DAAppCore.h"
//===================================================
// using DA namespace -- 禁止在头文件using!!
//===================================================

using namespace DA;

//===================================================
// DADataManageTableView
//===================================================
DADataManageTableView::DADataManageTableView(QWidget* parent) : QTableView(parent)
{
    setModel(new DADataManagerTableModel(DAAppCore::getInstance().getDataManagerInterface(), this));
    setShowGrid(false);
    setAlternatingRowColors(true);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::SingleSelection);
    //允许编辑
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
    QFontMetrics fm = fontMetrics();
    //高度为行高的1.2
    verticalHeader()->setDefaultSectionSize(fm.lineSpacing() * 1.2);
    verticalHeader()->hide();
}
